<style>
    .DataInfo td input {
        border: 1px solid #3197B5;
        height: 18px;
        padding: 6px 5px;
        font-size: 14px;
        width: 270px;
        float: left;
    }
    .DataInfo p{
        color: #f00;
        float: left;
        position: relative;
        z-index: 1;
        padding-left: 20px;
        margin: 7px 0 0 10px;
        display: inline;
    }
    .DataInfo p i{
        background: url(/images/share/ico.png) no-repeat 0 -96px;
        float: left;
        position: absolute;
        height: 14px;
        width: 14px;
        top: 3px;
        left: 0;
    }
</style>
<div class="center">
    <div class="home">
        <div class="home_left">
            <?php echo $this->partial('member/menu.phtml', array('uCount' => $this->uCount, 'menuId' => $this->menuId, 'user' => $this->user, 'account' => $this->account)); ?>
        </div>
        <div class="home_right">
            <div class="shezhi">
                <h1><i></i>个人设置</h1>

            </div>

            <div class="shezhinav">
                <ul>
                    <li class="shezhion"><a href="/member/profile"><i class="shezhi1"></i>个人信息设置</a></li>
                    <li><a href="/member/password"><i class="shezhi3"></i>修改登录密码</a></li>
                    <?php if ($this->User->State == 0) { ?>
                        <li><a href="/member/email"><i class="shezhi3"></i>修改邮箱</a></li>
                    <?php } ?>
                </ul>
            </div>

            <div class="profile">
                <?php if ($this->User->State == Application_Model_User::STATUS_New) { ?>
                    <span>您的邮箱还没激活，激活邮箱后能获取10积分并且能后续升级，请您激活！</span>
                <?php } ?>
                <form method="post" enctype="multipart/form-data" id="profile_form">
                    <div class="data first">

                        <div class="DataInfo">
                            <table border=0>
                                <tr>
                                    <td colspan="2"><div class="DataHD"><h1>个人资料</h1></div></td>
                                    <td width="30%" rowspan="7" valign='top'>
                                        <table border=0 cellpadding="0" cellspacing="0" width='100%' height='100%'>
                                            <!-- 头像显示 -->
                                            <tr>
                                                <td align='left' valign='top'><?php
                                                    $img = '';
                                                    $userId = $this->User->Id;
                                                    $temp_id = sprintf("%09d", $userId);

                                                    //1级目录
                                                    $l1 = substr($temp_id, 0, 3);

                                                    //2级目录
                                                    $l2 = substr($temp_id, 3, 2);

                                                    //3级目录
                                                    $l3 = substr($temp_id, 5, 2);

                                                    if ($this->User->Pic) {
                                                        $img = $this->User->Pic;
                                                        $img = '/data/avatar/' . $l1 . "/" . $l2 . "/" . $l3 . "/" . $img;
                                                    } else {
                                                        $img = '/data/avatar/' . "00.png";
                                                    }
                                                    ?>											  
                                                    <img src="<?php echo $img; ?>" width="180" height="180" />											</td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <input type="file" name="file" style="border:0px;"/>											
                                                </td>
                                            </tr>
                                        </table></td>
                                </tr>
                                <tr>
                                    <td class="Dz" nowrap>帐号：</td>
                                    <td><?php echo $this->User->Email; ?>　<?php if ($this->User->State == Application_Model_User::STATUS_New) { ?><a href="javascript:activation();" id="activation"><font font-size="10px" color="red">激活邮箱</font></a><?php } ?></td>
                                </tr>
                                <tr>
                                    <td class="Dz"><span style="color: #c00;">*&nbsp;</span>昵称：</td>
                                    <td><?php echo $this->formText('nickName', $this->profile->NickName) ?><p id="div_nickName" style="display:none;"><i></i>昵称不能为空</p></td>
                                </tr>
                                <tr>
                                    <td class="Dz"><span style="color: #c00;">*&nbsp;</span>姓名：</td>
                                    <td><?php echo $this->formText('name', $this->profile->Name) ?><p id="div_name" style="display:none;"><i></i>姓名不能为空</p></td>
                                </tr>
                                <tr>
                                    <td class="Dz">家乡：</td>
                                    <td><?php echo $this->formText('home', $this->profile->Home) ?></td>
                                </tr>
                                <tr>
                                    <td class="Dz">现居：</td>
                                    <td><?php echo $this->formText('address', $this->profile->Address) ?></td>
                                </tr>
                                <tr>
                                    <td class="Dz">语言：</td>
                                    <td><?php echo $this->formText('lang', $this->profile->Lang) ?></td>
                                    <td>&nbsp;</td>
                                </tr>
                                <tr>
                                    <td class="Dz"><span style="color: #c00;">*&nbsp;</span>生日：</td>
                                    <td colspan="2"><?php echo $this->formText('birthday', $this->profile->Birthday, array('onclick' => 'WdatePicker();')) ?>
                                    <p id="div_birthday" style="display:none;"><i></i>生日不能为空</p></td>
                                </tr>
                                <tr>
                                    <td class="Dz">性别：</td>
                                    <td><?php echo $this->formSelect('sex', $this->profile->Sex, null, array('男' => '男', '女' => '女')) ?></td>
                                    <td>&nbsp;</td>
                                </tr>
                                <tr>
                                    <td class="Dz">简介：</td>
                                    <td><?php echo $this->formTextarea('description', $this->profile->Description) ?></td>
                                    <td>&nbsp;</td>
                                </tr>
                            </table>
                        </div>
                    </div>
                    <div class="data">
                        <div class="DataHD">
                            <h1>联系方式</h1>
                        </div>
                        <div class="DataInfo">
                            <table>
                                <tr>
                                    <td class="Dz">备用邮箱：</td>
                                    <td><?php echo $this->formText('email', $this->profile->Email) ?><p id="div_email" style="display:none;"><i></i>邮箱不能为空</p></td>
                                </tr>
                                <tr>
                                    <td class="Dz"><span style="color: #c00;">*&nbsp;</span>QQ：</td>
                                    <td><?php echo $this->formText('qq', $this->profile->Qq,array("onkeyup"=>"value=value.replace(/[^\d]/g,'')","onbeforepaste"=>"clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))")) ?><p id="div_qq" style="display:none;"><i></i>QQ不能为空</p></td>
                                </tr>
                                <tr>
                                    <td class="Dz"><span style="color: #c00;">*&nbsp;</span>手机：</td>
                                    <td><?php echo $this->formText('tel', $this->profile->Tel) ?><p id="div_tel" style="display:none;"><i></i>手机不能为空</p></td>
                                </tr>
                            </table>
                        </div>
                    </div>
                    <div><input style="width:80px;height:40px;margin-left:100px;" type="button" value=" 保 存 " id="save_button"></div>
                </form>
            </div>

        </div>
    </div>
</div>
<div class="tanchuang" style="display:none;height: 300px;">
<div class="nui-msgbox">
    <div class="nui-msgbox-hd" style="font-size: 16px;">系统消息</div>
    <a class="nui-msgbox-close" title="关闭"><b></b></a>
</div>
<div class="wenti_box">
    <div style="margin-left: 20px;font-size: 16px;margin-top: 20px;width: 560px;">
        <h3>尊敬的<?php echo $this->User->nikename; ?>：</h3>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;　系统正在发送验证邮件，请您稍等……</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;　请在收到邮件后，及时激活！</p>
        <p style="margin-top: 20px;margin-left: 150px;"><a href="javascript:void(0)" class="exitproblem" ><span class="countdown">20</span>秒后自动关闭，立即关闭。</a></p>
    </div>
</div>
</div>


<script type="text/javascript">
    function activation() {
        $('#activation').hide();
        $('.tanchuang').show();            
        $.post('/member/activation');
        setInterval("CountDown()", 1000);
    }
    $("#nickName").blur(function(){
        var nickName = $("#nickName").val().trim();
        if(nickName == ""){
            $("#div_nickName").show();
            return ;
        } else {
            $("#div_nickName").hide();
        }
    });
    $("#name").blur(function(){
        var name = $("#name").val().trim();
        if(name == ""){
            $("#div_name").show();
            return ;
        } else {
            $("#div_name").hide();
        }
    });
    $("#birthday").blur(function(){
        var birthday = $("#birthday").val().trim();
        if(birthday == ""){
            $("#div_birthday").show();
            return ;
        } else {
            $("#div_birthday").hide();
        }
    });
    
    $("#tel").blur(function(){
        var tel = $("#tel").val().trim();
        if(tel == ""){
            $("#div_tel").show();
            return ;
        } else {
            $("#div_tel").hide();
        }
    });
    $("#save_button").click(function() {
        var nickName = $("#nickName").val().trim();
        var name = $("#name").val().trim();
        var birthday = $("#birthday").val();
        var qq = $("#qq").val().trim();
        var tel = $("#tel").val().trim();
        if(nickName == ""){
            $("#div_nickName").show();
            return ;
        } else if (name == ""){
            $("#div_name").show();
            return ;
        } else if (birthday == ""){
            $("#div_birthday").show();
            return ;
        } else if (tel == ""){
            $("#div_tel").show();
            return ;
        } else {
            $("#profile_form").submit();
        }
    });
    var leftSeconds = 20;
    function CountDown() {
        if(leftSeconds<=0){
            $(".exitproblem").click();
        }
        leftSeconds--;
        $(".countdown").html(leftSeconds);        
    }
    $(".exitproblem").click(function(){
        $("div.tanchuang").hide();
    }); 
    $(".nui-msgbox-close").click(function(){
        $("div.tanchuang").hide();
    });
</script>